-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Configure connections using DNS domain names #2047
Conversation
46e95c4
to
9d71720
Compare
9d71720
to
cc206b2
Compare
b368416
to
baa2494
Compare
cc206b2
to
b57ca6c
Compare
baa2494
to
b4fab59
Compare
01c0a38
to
1f3d6b7
Compare
b4fab59
to
7901caf
Compare
49c7e38
to
f3f362e
Compare
7901caf
to
c251493
Compare
f3f362e
to
a0c1b4e
Compare
c251493
to
a6c517d
Compare
a0c1b4e
to
8aaa907
Compare
a6c517d
to
040a9d1
Compare
cf7698a
to
7475041
Compare
040a9d1
to
f9960d9
Compare
f9960d9
to
e8f506c
Compare
7475041
to
8ceb527
Compare
8ceb527
to
cf79bec
Compare
3bd264a
to
fe70759
Compare
cf79bec
to
170f88f
Compare
fe70759
to
b0942f4
Compare
170f88f
to
4ad47df
Compare
b0942f4
to
6062f19
Compare
4ad47df
to
e885216
Compare
de8f2dd
to
2b909fd
Compare
0f1d338
to
c389387
Compare
475ac57
to
ca711d8
Compare
} else { | ||
dns = instanceMetadata.getDnsName(); | ||
} | ||
|
||
if (dns == null || dns.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String.isNullOrEmptry(dns) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
"cloudSqlInstance property not set. Please specify this property in the JDBC URL or the " | ||
+ "connection Properties with value in form \"project:region:instance\""); | ||
config.getCloudSqlInstance() != null || config.getDomainName() != null, | ||
"cloudSqlInstance property and hostname not set. Please specify" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
try { | ||
return new CloudSqlInstanceName(name); | ||
} catch (IllegalArgumentException e) { | ||
// Not a well-formed instance name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shallowing exception ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use CloudSqlInstanceName.isValidInstanceName()
instead.
ca711d8
to
3cd89b1
Compare
3cd89b1
to
595bfe3
Compare
c389387
to
69c1d42
Compare
e0bbb24
to
914dfdb
Compare
69c1d42
to
367102f
Compare
367102f
to
3c91ade
Compare
914dfdb
to
78f1345
Compare
f2bba72
to
221aeac
Compare
78f1345
to
06dec39
Compare
221aeac
to
fe9437a
Compare
06dec39
to
a993bcd
Compare
a993bcd
to
93691d5
Compare
The dialer may be configured to use a DNS name to look up the instance
name instead of configuring the connector with the instance name directly.
Add a DNS TXT record for the Cloud SQL instance to a private DNS server
or a private Google Cloud DNS Zone used by your application. For example:
Open a database connection using the DNS name:
HOST: The domain name configured in your DNS TXT record.
Base JDBC URL:
jdbc:mysql://<HOST>/<DATABASE_NAME>
SOCKET_FACTORY_CLASS:
com.google.cloud.sql.mysql.SocketFactory
The full JDBC URL for MySQL should look like this:
See also: the Cloud SQL Go Connector implementation
Part of #2043